Conversation
Slamdunk
left a comment
There was a problem hiding this comment.
Hi, the idea is good, we need to shape it for general purpose though.
Please make the tests pass, and run the PHP-CS-Fixer to apply the code style this library follows.
.gitignore
Outdated
| composer.lock | ||
| phpunit.xml | ||
| .idea/ | ||
| phpunit.xml.dist |
There was a problem hiding this comment.
We need phpunit.xml.dist in the package, please revert .gitignore file
| verbose="true" | ||
| bootstrap="./vendor/autoload.php" | ||
| colors="true" | ||
| verbose="true" |
There was a problem hiding this comment.
We want to keep one indentation for this file, please revert it.
| self::TRASH => ['trash', 'bin', 'INBOX.trash', '[Gmail]/trash'], | ||
| self::TEMPLATES => ['templates'], | ||
| self::ARCHIVES => ['archives',], | ||
| ]; |
There was a problem hiding this comment.
ID of special folder vary a lot from different email provider, I don't want to have a static list to keep up to date.
What about letting the user specify it in the constructor, so this library doesn't have to maintain it?
There was a problem hiding this comment.
I think those are common ones. All other folders are simply listed
There was a problem hiding this comment.
Unfortunately not, those are not as common as you may think.
I work with a lot of IMAP servers where these special folders have many other aliases: only for the Trash one I have 15 variants 😞 in English, without counting localizations.
I'm still against to maintain this list: let the user specify them.
Also the tests would be much more easy to implement and verify.
| self::TRASH => 'Trash', | ||
| self::TEMPLATES => 'Templates', | ||
| self::ARCHIVES => 'Archives', | ||
| ]; |
There was a problem hiding this comment.
The same goes for folder names: if you need them, let the user specify them as a constructor dependency.
We don't have the resources to maintain translations.
There was a problem hiding this comment.
You can manually name special folders with setSpecialFoldersNames.
and add special folders Id with addSpecialFolderId
| * | ||
| * @param MailboxInterface[] $mailboxes | ||
| */ | ||
| public function __construct($mailboxes) |
There was a problem hiding this comment.
I think in php 7.0 I cannot use public function __construct(MailboxInterface[] $mailboxes)
There was a problem hiding this comment.
No, but you can typehint the array at least.
There was a problem hiding this comment.
I still see __construct($mailboxes).
Can you change this to __construct(array $mailboxes)?
| $this->specialFoldersIds[$specialFolder][] = $id; | ||
| } | ||
|
|
||
| private function getFolderLevel($mailboxName, $delimiter) |
There was a problem hiding this comment.
Please add type-hints, return-type and doc-block
| namespace Ddeboer\Imap\MailboxesParser; | ||
|
|
||
|
|
||
| class MailboxesTreeParser |
There was a problem hiding this comment.
Please make it final and add an Interface for it
| * | ||
| * @return array | ||
| */ | ||
| public function parse($input) |
There was a problem hiding this comment.
Please add type-hints and the return-type
|
|
||
| use Ddeboer\Imap\MailboxInterface; | ||
|
|
||
| class ParsedMailbox |
There was a problem hiding this comment.
Please make it final and add an Interface for it
| /** | ||
| * @param MailboxInterface $mailbox | ||
| */ | ||
| public function setMailbox(MailboxInterface $mailbox) |
There was a problem hiding this comment.
Can we move all the setters to be the constructor?
There was a problem hiding this comment.
this is internal helper class I see no point.
There was a problem hiding this comment.
The point is that immutable objects are far more easy to maintain.
|
I've changed files. |
|
Thanks for the changes. Still please make the tests pass, and run the PHP-CS-Fixer to apply the code style this library follows. |
|
I said I'm not github fluent. I don't know what that is :) |
|
On the bottom of this Pull Request you can see a red cross near If you click on the "Details" link you can see that Travis, a continuous integration server, pulled your PR and performed some checks that this library asked Travis to do. At the time of writing, those checks are done against three different PHP versions, and if you click in each of them you can see what are the failures that are marking your PR as failing. The first failure I see is: And the second failure I see is that you didn't run the following command: That fix the coding style of the code you wrote. Please try to fix those failure: if you need more help I'm here. |
|
Vendor binaries must be run from the project root folder. From the imap project repository run these commands: You need both to pass. |
|
I give up. Fix the code on Your own - sorry. |
|
I'm sad that you are giving up. Though, each new functionality must be well tested and checked. I'll leave this PR open: if you ever want to finish it, we'll be thankful. |
|
I did add tests. I don't know what travis wants. You can fetch code and fix it on Your own. |
|
I'm sorry but you can't share a code that isn't proved to be working and expect someone else to fix it. I can help you if you don't understand the tools, but it is up to you to provide the functionality and its tests, and to prove everything works fine. |

I'm adding mailboxesParser. It sorts mailboxes and fetches special folders like "sent", "inbox", "trash". Tests are in
tests\MailboxesParser\.Usage: